import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:series_play/pages/home/home_category_page.dart';

import '../../comm/base/base_state.dart';
import '../../widget/app_text.dart';
import '../../widget/app_tab.dart';
import 'for_you_controller.dart';
import 'for_you_video_feed_page.dart';

/// 推荐页面
class ForYouPage extends StatefulWidget {
  const ForYouPage({super.key});

  @override
  State<ForYouPage> createState() => _ForYouPageState();
}

class _ForYouPageState extends BaseState<ForYouPage>
    with TickerProviderStateMixin {
  late TabController _tabController;

  final List<String> tabs = ['推荐', '全部短剧'];

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

  @override
  Widget buildPage(BuildContext context) {
    return Stack(
      children: [
        Positioned.fill(
          child: TabBarView(
            controller: _tabController,
            children: [
              ForYouVideoFeedPage(),
              Padding(
                padding: EdgeInsets.only(
                  top: context.mediaQueryPadding.top + 46.w + 10.w,
                ),
                child: HomeCategoryPage(),
              ),
            ],
          ),
        ),

        Positioned(
          left: 0,
          right: 0,
          top: context.mediaQueryPadding.top,
          child: Container(
            alignment: Alignment.center,
            height: 46.w,
            child: AppTab.forYou(tabs, _tabController),
          ),
        ),
      ],
    );
  }

  @override
  bool hideAppbar() {
    return true;
  }

  @override
  bool safeAreaFormTop() {
    return false;
  }
}
